package com.example.min.restappmobile;

import java.util.Dictionary;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Alexander on 29.03.2015.
 */
public class Session {

    private final static String EMPTY_S = "";
    private static Map<String, String> sessionItems = new HashMap<String, String>();

    public static void setSessionItem(String key, String value) {
        if(key.equals(EMPTY_S)) {
            throw  new IllegalArgumentException("key cannot be empty string");
        }
        sessionItems.put(key, value);
    }

    public static String getSessionItem(String key) {
        if(!sessionItems.containsKey(key)) {
            return  "";
        }
        return  sessionItems.get(key);
    }
}
